﻿<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                    xmlns:Fluent="clr-namespace:Fluent">
    <Style x:Key="RibbonContextualTabGroupStyle"
           TargetType="{x:Type Fluent:RibbonContextualTabGroup}">
        <Setter Property="Template"
                Value="{DynamicResource RibbonContextualTabGroupControlTemplate1}" />
        <Setter Property="Width"
                Value="Auto" />
        <Setter Property="HorizontalAlignment"
                Value="Stretch" />
        <Setter Property="Focusable"
                Value="False" />
    </Style>
    <ControlTemplate x:Key="RibbonContextualTabGroupControlTemplate1"
                     TargetType="{x:Type Fluent:RibbonContextualTabGroup}">
        <Border x:Name="rootBorder"
                Visibility="{TemplateBinding InnerVisibility}"
                Margin="2,0,0,0"
                HorizontalAlignment="Stretch"
                VerticalAlignment="Top"
                Width="Auto"
                Height="25"
                BorderThickness="1,0"
                Background="{DynamicResource TransparentBrush}">
            <Border.BorderBrush>
                <LinearGradientBrush EndPoint="0.5,1"
                                     StartPoint="0.5,0">
                    <GradientStop Color="#F2FFFFFF"
                                  Offset="0" />
                    <GradientStop Color="#CCFFFFFF"
                                  Offset="1" />
                </LinearGradientBrush>
            </Border.BorderBrush>
            <Border BorderBrush="{TemplateBinding BorderBrush}"
                    BorderThickness="1,0"
                    Background="{x:Null}"
                    Margin="0,0,0,-25"
                    VerticalAlignment="Top"
                    Height="25">
                <Grid Margin="0"
                      VerticalAlignment="Top"
                      Height="25">
                    <Rectangle Fill="{TemplateBinding Background}"
                               Stroke="{x:Null}"
                               HorizontalAlignment="Stretch"
                               VerticalAlignment="Stretch"
                               Width="Auto"
                               Height="Auto"
                               StrokeThickness="0">
                        <Rectangle.OpacityMask>
                            <LinearGradientBrush EndPoint="0.5,1"
                                                 StartPoint="0.5,0">
                                <GradientStop Color="Black"
                                              Offset="0" />
                                <GradientStop Color="#59000000"
                                              Offset="1" />
                                <GradientStop Color="Black"
                                              Offset="0.16" />
                                <GradientStop Color="#99000000"
                                              Offset="0.161" />
                            </LinearGradientBrush>
                        </Rectangle.OpacityMask>
                    </Rectangle>
                    <Rectangle Stroke="{x:Null}"
                               HorizontalAlignment="Stretch"
                               VerticalAlignment="Stretch"
                               Width="Auto"
                               Height="Auto"
                               Fill="#3FD2D2D2">
                        <Rectangle.OpacityMask>
                            <LinearGradientBrush EndPoint="0.5,1"
                                                 StartPoint="0.5,0">
                                <GradientStop Color="Black"
                                              Offset="0" />
                                <GradientStop Color="#7F000000"
                                              Offset="1" />
                                <GradientStop Color="Black"
                                              Offset="0.16" />
                                <GradientStop Color="#B2000000"
                                              Offset="0.161" />
                            </LinearGradientBrush>
                        </Rectangle.OpacityMask>
                    </Rectangle>
                    <TextBlock Text="{TemplateBinding Header}"
                               HorizontalAlignment="Center"
                               VerticalAlignment="Center"
                               Margin="5,0"
                               TextTrimming="None"
                               Foreground="#00000000"
                               FontWeight="Bold" />
                    <TextBlock Text="{TemplateBinding Header}"
                               HorizontalAlignment="Center"
                               VerticalAlignment="Center"
                               Margin="5,0"
                               TextTrimming="CharacterEllipsis"
                               FontWeight="Bold">
                        <TextBlock.Effect>
                            <BlurEffect Radius="2" />
                        </TextBlock.Effect>
                    </TextBlock>
                    <TextBlock Text="{TemplateBinding Header}"
                               HorizontalAlignment="Center"
                               VerticalAlignment="Center"
                               Margin="5,0"
                               TextTrimming="CharacterEllipsis"
                               Foreground="White"
                               FontWeight="Bold" />
                </Grid>
            </Border>
        </Border>
        <ControlTemplate.Triggers>
            <Trigger Property="IsWindowMaximized"
                     Value="True">
                <Setter Property="Margin"
                        TargetName="rootBorder"
                        Value="2,2,0,-0.1" />
            </Trigger>
        </ControlTemplate.Triggers>
    </ControlTemplate>
</ResourceDictionary>